<!DOCTYPE HTML>
<html>
  <head>
    <title>index</title>
  </head>
  <body>
    <div id="div"></div>
	<pre>
	public class Singleton{
		private static Singleton instrance = null;
		private static ReadOnly Object locker = new Object();
		private Singleton(){}
		public static Singleton GetSingleton(){
			if(instrance==null){
				lock(locker){
					if(instrance==null){
						instrance = new Singleton();
					}
				}
				return instrance;
			}
		}
	}
	</pre>
    <script>
      var div = document.getElementById('div')
      var fn1 = (function () {
		  var a = function () {
			div.innerHTML += ' first '
		  }
		  var b = window.onload
		  a()
		  if (b) {
			b()
		  }
	  }())
	  var fn2 = (function () {
		  var a = function () {
			div.innerHTML += ' scond '
		  }
		  var b = window.onload
		  a()
		  if (b) {
			b()
		  }
	  }())
	  function quickSort (arr) {
  if (arr.length <= 1) { return arr }
  var mid = Math.floor(arr.length / 2), val = arr.splice(mid, 1)[0]
		var left = [], right = []
		for (var i = 0; i < arr.length; i++) {
    console.log(arr[i], i)
    if (arr[i] < val) {
      left.push(arr[i])
    } else{
      right.push(arr[i])
    }
  }
  console.log(left, right)
  return quickSort(left).concat([val], quickSort(right))
	  }

function _parseInt (str, radix) {
  let str_type = typeof str
 let res = 0
 if (str_type !== 'string' && str_type !== 'number') {
  // 如果类型不是 string 或 number 类型返回NaN
    return NaN
  }

  // 字符串处理
  str = String(str).trim().split('.')[0]
  let length = str.length
 if (!length) {
  // 如果为空则返回 NaN
    return NaN
  }

  if (!radix) {
  // 如果 radix 为0 null undefined
  // 则转化为 10
    radix = 10
 }
  if (typeof radix !== 'number' || radix < 2 || radix > 36) {
    return NaN
  }

  for (let i = 0; i < length; i++) {
    let arr = str.split('').reverse().join('')
  res += Math.floor(arr[i]) * Math.pow(radix, i)
  }

  return res
}
    </script>
  </body>
</html>

